﻿using IotWeek2Day9.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;

namespace IotWeek2Day9.WebApi.Models
{
    public class ItemDto
    {
        public int ItemId { get; set; }

        ///// <summary>
        ///// 事项编号
        ///// </summary>
        //public string ItemNo { get; set; }

        /// <summary>
        /// 事项标题
        /// </summary>
        public string Title { get; set; }

        /// <summary>
        /// 事项的状态
        /// </summary>
        public ItemStatus Status { get; set; }

        public string StatusString { get; set; }
        /// <summary>
        /// 开始时间
        /// </summary>
        public DateTime StartTime { get; set; }

        /// <summary>
        /// 结束时间
        /// </summary>
        public DateTime EndTime { get; set; }

        /// <summary>
        /// 关联人（复选框，可多选，存人名）
        /// </summary>
        public string Contact { get; set; }

        //导航属性
        public string EmpName { get; set; }

        /// 图片路径的字段
        /// </summary>
        [StringLength(255)]
        public string FilePath { get; set; }
    }


    /// <summary>
    /// DTO：Data Transfer Object 数据传输对象
    /// 作用： 1.  限制输入、输出的字段数量
    ///        2.  在新增、修改的时候，对字段验证
    /// </summary>
  public class CreateItemDto
    {
        public int ItemId { get; set; }

        /// <summary>
        /// 事项编号
        /// </summary>
        [StringLength(20)]
        [Required]
        public string ItemNo { get; set; }

        /// <summary>
        /// 事项标题
        /// </summary>
        [StringLength(50)]
        [Required]
        public string Title { get; set; }

        ///// <summary>
        ///// 事项的状态
        ///// </summary>
        //public ItemStatus Status { get; set; }

        /// <summary>
        /// 开始时间
        /// </summary>
        public DateTime StartTime { get; set; }    //值类型默认就是非空的

        /// <summary>
        /// 结束时间
        /// </summary>
        public DateTime EndTime { get; set; }

        /// <summary>
        /// 事项描述
        /// </summary>
        [StringLength(200)]
        [Required]
        public string ItemDetail { get; set; }

        /// <summary>
        /// 关联人（复选框，可多选，存人名）
        /// </summary>
        public string Contact { get; set; }

        /// <summary>
        /// 当事人
        /// </summary>
        public int EmpId { get; set; }


        /// <summary>
        /// 图片路径的字段
        /// </summary>
        [StringLength(255)]
        public string FilePath { get; set; }
    } 

}
